<Query Kind="VBStatements">
  <Connection>
    <ID>a50d59f2-50a7-4e3c-b893-7b7c3ce076e7</ID>
    <Server>WEBSQL</Server>
    <Database>abpc</Database>
    <ShowServer>true</ShowServer>
  </Connection>
  <Namespace>Microsoft.VisualBasic</Namespace>
</Query>

	' Properties are functions that look/behave like variables
	' Think of them as variables with rules.

	MyBirthday = "03/23/1977"
	MyAge.Dump("My Age")
	MyBirthday = "1/1/2000"
	MyAge.Dump("My Age")	
	
	' These won't work, so uncomment them if you want to see the error
	'MyAge = 30  ' MyAge is ReadOnly
	'Dim x = MyBirthday  ' MyBirthday is WriteOnly

	' Set the temperature
	CurrentTempInCelcius = 0
	CurrentTempInFerenheit.Dump("What is freezing in Ferenheit?")
	
	CurrentTempInFerenheit = 0
	CurrentTempInCelcius.Dump("What's zero in celcius?")

	CurrentTempInFerenheit = 100
	CurrentTempInCelcius.Dump("What's 100 in celcius?")
	
	MySalary = 0
	MySalary.Dump("Sets the salary to the minimum")
	MySalary = 40000
	MySalary.Dump("A valid salary")
	MySalary = 10000000
	MySalary.Dump("The salary cap kicks in...")

End Sub ' For LINQPad



' A read-only property
ReadOnly Property MyAge() As Integer
	Get
		return DateDiff(DateInterval.Year, HiddenBirthdayField, Now)
	End Get
End Property


' Let's create a variable to store the birthday
Private HiddenBirthdayField As Date = "11/27/1918"

WriteOnly Property MyBirthday() As Date
	Set(NewBirthday As Date)
		HiddenBirthdayField = NewBirthday
	End Set
End Property


Private HiddenTemperatureFieldInCelcius As Decimal = 0

' A  read/write property
Public Property CurrentTempInCelcius As Decimal
	Get
		return HiddenTemperatureFieldInCelcius
	End Get
	Set(NewTemp As Decimal)
		HiddenTemperatureFieldInCelcius = NewTemp
	End Set
End Property

' A  read/write property
Public Property CurrentTempInFerenheit As Decimal
	Get
		return (HiddenTemperatureFieldInCelcius * 1.8) + 32
	End Get
	Set(NewTemp As Decimal)
		HiddenTemperatureFieldInCelcius = (NewTemp - 32) / 1.8
	End Set
End Property

Private HiddenSalaryField As Decimal = 10000

Public Property MySalary() As Decimal
	Get
		return HiddenSalaryField
	End Get
	Set(NewSalary As Decimal)
		' The minimum should be 10000
		If NewSalary < 10000 Then NewSalary = 10000
		' The maximum should be 150000
		If NewSalary > 150000 Then NewSalary = 150000
		HiddenSalaryField = NewSalary
	End Set
End Property


Sub Fake ' For LINQPad

